package com.zxy.shaozhiyi1.main.test;

import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class WebTest1 {
	private WebDriver webdriver;
	private String url;

	@Before
	public void setUp() throws Exception {
		System.setProperty("webdriver.firefox.marionette", "D:\\geckodriver.exe");
		System.setProperty("webdriver.firefox.bin", "D:\\developtools\\Mozilla Firefox\\firefox.exe");
		webdriver = new FirefoxDriver();
		url = "http://www.baidu.com";
		webdriver.manage().timeouts().implicitlyWait(300, TimeUnit.SECONDS);

	}

	@After
	public void tearDown() throws Exception {
		webdriver.quit();
	}

	@Test
	public void testWebTest() throws Exception {
		webdriver.get(url + "/");
		WebElement element = webdriver.findElement(By.id("kw"));
		element.clear();
		element.sendKeys("test");
		WebElement submitElement = webdriver.findElement(By.id("su"));
		submitElement.click();
	}

}